import React from 'react'
import { Form, Button, Input } from 'antd'
import { useDispatch } from 'react-redux'
import { doLogin } from '@/store/slices/user';
export default function Login() {
  const dispatch = useDispatch();
  const userLogin = (params: any) => {
    dispatch(doLogin(params))
  }
  return (
    <Form
      onFinish={userLogin}
    >
      <Form.Item label="用户名" name="userName" rules={[
        {
          required: true,
          message: '用户名必填'
        }
      ]}>
        <Input/>
      </Form.Item>
      <Form.Item label="密码" name="pwd" rules={[
        {
          required: true,
          message: '密码'
        }
      ]}>
        <Input type='password'/>
      </Form.Item>
      <Form.Item>
        <Button htmlType='submit'>登录</Button>
      </Form.Item>
    </Form>
  )
}
